<template>
  <div class="app-container">
    <el-page-header @back="goBack" content="检查详情"></el-page-header>
    <div
      style="
        border: 1px solid rgb(213, 213, 213);
        background: rgb(239, 239, 239);
        padding: 20px;
        margin-top: 20px
      "
    >
      <el-form :data="formData">
        <el-form-item prop="checkName" label="检查组长：">
          {{ formData.groupLeaderList }}
        </el-form-item>
        <el-form-item prop="checkName" label="检查人员：">
          {{ formData.groupMemberList }}
        </el-form-item>
        <el-form-item prop="checkName" label="检查时间：">
          {{ formData.planStartTime }}至{{formData.planEndTime}}
        </el-form-item>
        <el-form-item prop="checkName" label="所属部门：">
          {{ formData.deptName }}
        </el-form-item>
        <!-- <el-form-item prop="checkName" label="检查说明：">
          {{ formData. }}
        </el-form-item> -->
      </el-form>
    </div>
    <el-tabs v-model="activeName">
      <el-tab-pane label="检查情况" name="first">
        <el-form  :data="dangerData">
          <el-form-item prop="checkName" label="检查类型：">
            {{ dangerData.checkTypeName}}
          </el-form-item>
          <el-form-item prop="checkName" label="任务名称：">
            {{ dangerData.checkName }}
          </el-form-item>
          <el-form-item prop="checkName" label="计划检查时间：">
            {{ formData.planStartTime }}至{{formData.planEndTime}}
          </el-form-item>
          <el-form-item prop="checkName" label="检查依据：">
            {{ formData.checkBasisName }}
          </el-form-item>
          <el-form-item prop="checkName" label="发现隐患数：">
            {{ formData.bizEnterTask.hiddenNumber }}
          </el-form-item>
          <el-form-item prop="checkName" label="检查说明：">
            {{ dangerData.checkExplain }}
          </el-form-item>
          <!-- <el-form-item prop="checkName" label="其他说明：">
            {{ dangerData. }}
          </el-form-item> -->
          <!-- <el-form-item prop="checkName" label="现场照片：">
            {{ dangerData. }}
          </el-form-item> -->
        </el-form>
      </el-tab-pane>
      <el-tab-pane label="检查记录" name="third">
        <el-table :data="tableData" style="width: 100%">
          <el-table-column type="index" label="序号">
          </el-table-column>
          <el-table-column prop="hiddenDangerStatusName" label="隐患状态" width="140" align="center">
          </el-table-column>
          <el-table-column prop="checkTime" label="检查时间" width="180">
          </el-table-column>
          <el-table-column prop="checkPeopleNickName" label="检查人" width="120"> </el-table-column>
          <el-table-column prop="reviseTheDates" label="整改期限" width="180"> </el-table-column>
          <el-table-column prop="revisePeopleNickName" label="整改人" width="120"> </el-table-column>
          <el-table-column prop="address" label="隐患内容" align="center">
            <template slot-scope="scope">
          <el-tag
            type="warning"
            effect="dark"
            size="mini"
            v-if="scope.row.accidentHidden == 1"
            >一般</el-tag
          >
          <el-tag
            type="warning"
            effect="dark"
            size="mini"
            color="red"
            v-if="scope.row.accidentHidden == 2"
            >重大</el-tag
          >
          {{ scope.row.reviseRequire }}
          <div>
            <i
              class="el-icon-location-information"
              style="
                background: rgb(235, 236, 240);
                padding: 5px;
                margin-right: 5px;
              "
            >
              {{ scope.row.dutyArea }}
            </i>
          </div>
        </template>
          </el-table-column>
          <el-table-column label="操作" width="160">
            <template slot-scope="scope">
              <el-button type="text" @click="look(scope.row)">查看隐患详情</el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-tab-pane>
    </el-tabs>
    <el-dialog
        width="45%"
        title="隐患详情"
        :visible.sync="innerVisible"
        append-to-body
      >
        <DialogLook :id="id"></DialogLook>
      </el-dialog>
  </div>
</template>

<script>
import {getExamine,} from "@/api/biz/enter/enterNext";
import {listEnter,} from "@/api/biz/enter/enter";
export default {
  data() {
    return {
      innerVisible: false,
      activeName: "first",
      tableData: [],
      id:null,
      formData:{
        groupLeaderList:null,
        groupMemberList:null,
        planEndTime:null,
        planStartTime:null,
        deptName:null,
        bizEnterTask:{
          hiddenNumber:null,
        }
      },
      dangerData:{

      }
    };
  },

  methods: {
    look(row){
      this.id = row.id;
      this.innerVisible = true;
    },
    getList(){
      getExamine(this.$route.query.id).then(data=>{
        this.formData = data.data
        this.formData.groupLeaderList = this.formData.groupLeaderList.join(", ")
        this.formData.groupMemberList = this.formData.groupMemberList.join(", ")
        this.tableData = data.data.bizProjectCheckRecords
      })
      let data = {
        id:this.$route.query.ids
      }
      listEnter(data).then(data=>{
        this.dangerData = data.rows[0]
      })
    },
    //返回
    goBack() {
      this.$router.back()
      this.$store.state.tagsView.visitedViews =
        this.$store.state.tagsView.visitedViews.filter(
          (item) => item.name !== "enterMyLookDate"
        );
    },
  },

  components: {},

  computed: {},

  created() {
    this.getList()
  },
};
</script>
<style scoped></style>
